package com.cy.bean;



import java.util.Timer;
import java.util.TimerTask;


public class CodeTimer {

    private static TimerTask timerTask;

    public void time3(int state, String phone, CodeTool codeTool) {
        // new定时器
        Timer timer = new Timer();
        timerTask = new TimerTask() {
            @Override
            public void run() {
                if (state == 0) {
                    codeTool.setState(1);
                    codeTool.refreshCode(phone);
                }
                timer.cancel();
            }
        };
        timer.schedule(timerTask, 120000);
    }
}
